package com.molichuxing.services.property;

/**
 * 围栏类型
 */
public enum IovFenceShapeEnum {

    /**
     * 圆
     */
    CIRCLE(1, "圆"),
    /**
     * 正方形
     */
    SQUARE(2, "正方形"),

    /**
     * 多边形
     */
    POLYGON(3, "多边形");

    int value;
    String name;

    IovFenceShapeEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }


    /**
     * 通过value获取枚举的name
     *
     * @param value
     * @return
     */
    public static String getName(int value) {
        IovFenceShapeEnum enumerate = getEnum(value);
        return enumerate == null ? null : enumerate.getName();
    }

    /**
     * 通过value获取枚举
     *
     * @param value
     * @return
     */
    public static IovFenceShapeEnum getEnum(int value) {
        for (IovFenceShapeEnum enumerate : IovFenceShapeEnum.values()) {
            if (enumerate.getValue() == value) {
                return enumerate;
            }
        }
        return null;
    }

}
